<!doctype html>
<html lang="en">
<head>
	<title><?php echo $title; ?></title>
	<meta http-equiv="content-type" content="text/html; charset=windows-1252">
	<link type="image/x-icon" rel="shortcut icon" href="<?php echo base_url().F_IMG; ?>shortcut_postleng.ico" />
	<?php
	$segment_op = $this->uri->segment(2);
	if ($segment_op == "facebookcomments" || $segment_op == "facebooklikebutton") {
		echo $open_graph; 
	}
	?>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<script type="text/javascript" src="<?php echo base_url() . F_JS; ?>jquery-1.10.2.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
     		 //fade in/out based on scrollTop value
     		 $('#scroller').hide();
     		 <?php 
     		 if($segment_op != "create-post"){
     		 	?>
     		 	$(window).scroll(function () {	
     		 		if ($(this).scrollTop() > 200) {
     		 			$('#scroller').fadeIn();
     		 		} else {
     		 			$('#scroller').fadeOut();
     		 		}
     		 	});
     		 	$('#scroller').click(function () {
     		 		$('body,html').animate({
     		 			scrollTop: 0
     		 		}, 600);
     		 		return false;
     		 	});
     		 	<?php
     		 }
     		 ?>
     		 var detector = {};
     		 detector.isMobileDevice = function() {
     		 	return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1);
     		 };
     		});
	</script>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url() . F_CSS; ?>jquery.autocomplete.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url() . F_CSS; ?>tag.css" />
	<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
	<?php
	$segment = $this->uri->segment(2);
	if($this->uri->segment(1)=="posts" && $segment == "create-posts"){
		?>
		<!-- Bootstrap select plugin -->
		<style type="text/css" media="all">
			/* fix rtl for demo */
			.chosen-rtl .chosen-drop { left: -9000px; }
		</style>
		<!-- End of bootstrap select plugin --> 
		<?php
		} /// end bootrap seleted
		?>
		<link href='http://fonts.googleapis.com/css?family=Khmer' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>media-screen-custom.css">
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>bootstrap.min.css">
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>bootstrap.css">
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>quate.css">
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>btn_custom.css" /> 
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>related_posts.css" />
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>tag.css" />
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>facebook.css" />
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>icons_custom.css" />
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>custom_style.css" />
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>modal_custom.css" />
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>prism.css">
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>chosen.css">
		<link rel="stylesheet" href="<?php echo base_url() . F_CSS; ?>create_post.css">
		<script type="text/javascript" src="<?php echo base_url() . F_JS; ?>bootstrap.min.js"></script>
		<!-- scripts at bottom of page -->
		<style>
			*{
				font-family: 'Khmer', cursive;
				font-size: inherit; 
			}
			body{
				margin: 0;
				padding: 0;	
			}
			.input-append {
				background: #FFF;
				padding: 1px;
				margin-top: 4px;
				border-radius: 2px 2px 2px 2px;
				border: 1px solid #324F68;
				margin-top: -54px; 
				margin-right: 35px; 
				float: right; 
				height:38px;
			}
			.modal-open{
				position: fixed !important;
			}
			.bgdescolor {
				margin-top: -15px;
			}
			.input-group-btn {
				position: absolute;
				left: 0px;
				top: 0px;
			}
			.imagecolumn img {
				width: 100%;
			}
			.box-url{
				display: none;
			}
			.oembedall-closehide{
				display: none;
			}
			.thumbnails{
				font-size: 16px;
			}
			.text-icons{
				text-align: center;
			}
			.data_not_found {
				text-align:center; color:red; 
				border:1px solid #ddd;
				font-size:18px; 
				line-height:45px;
				padding: 39px;
				width: 45%;
				margin:auto;
				background: #fff;
			}
			<?php
			if($segment_op != "create-post"){
				?>
				@media only screen and (max-width: 588px){
					.div-menu{
						height: 70px !important;
					}
					.new-post-btn{
						float: left !important;
					}
				}
				<?php
			}
			?>
			/** End of Responsive Medai Query ========== **/
			/* // Tag cloud */
		</style>
		<style type="text/css" media="all">
			/* fix rtl for demo */
			.chosen-rtl .chosen-drop { left: -9000px; }
		</style>
	</head>
	<body class="demos" style="background-color: #F5F5F5" onkeydown="TriggeredKey(this)">

		<!-- Div Scroll to top -->
		<span id="scroller" style="cursor: pointer;z-index: 10000; opacity: 0.5; bottom: 2%; position: fixed;right: 2%;"><img src="<?php echo base_url().F_IMG; ?>scrolltop.png" width="40"></span>
		<!-- End Scroll to top -->
		<!-- pop up  -->
		<div class="modal" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
			<div class="modal-dialog modal-vertical-centered " style="width: 95%;">
				<div class="modal-content" style=" background: #FFF;">
					<div class="modal-header" style="padding-top: 30px;">
						<button onclick="clearIDCount()" type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-top: -28px;"><img style="width:20px; height:20px; " src="<?php echo base_url().F_IMG; ?>closebtn.png" /></button>

					</div>
					<div class="modal-body" style="padding-top: 0;">
						<div class="row" style="padding-bottom:0px !important;">
							<ul class="thumbnails" style="padding: 0;">
								<div class="col-md-6 div_image_responsive" style="margin-left: 0%; height: auto !important;">
									<li class="thumbnail image-response" style="background: none !important; padding-bottom: 0!important;"><img id="img_view" class="thumbnail" src="<?php echo base_url().F_IMG; ?>5.jpg" /></li>
									<li class="thumbnail social-media" style="height: 90px !important; width: 100%; background: none !important; margin-top: -10px;">

										<!-- facebook like button and share button -->
										<!-- Facebook like button -->
										<div id="fb-root"></div>
										<script>(function(d, s, id) {
											var js, fjs = d.getElementsByTagName(s)[0];
											if (d.getElementById(id)) return;
											js = d.createElement(s); js.id = id;
											js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
											fjs.parentNode.insertBefore(js, fjs);
										}(document, 'script', 'facebook-jssdk'));</script>
										<div id="facebooklikebutton" style="float: left; width: 60px;">
											<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-width="100" data-layout="box_count" data-action="like" data-show-faces="false" data-share="false"></div>

										</div>
										<div id="googleplusbutton" style="float: left; width: 60px; margin-left: 5px; margin-top: 1px;">
											<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
											<g:plusone size="tall" annotation="bubble"></g:plusone>
										</div>

										<div id="tweenbutton" style="float: left; width: 60px; margin-left: 6px; margin-top: -1px;">                        
											<!-- Tweet Button -->

											<a href="https://twitter.com/share" style="float: left;" class="twitter-share-button tweet" data-url="" data-counturl="" data-lang="en" data-count="vertical">Tweet</a>

											<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>    
											<!-- End of Tweet button -->

										</div>

									</li>
								</div>
							</ul><br />
							<div class="col-md-6 line_relate_two">
								<div class="col-md-6" style="padding-bottom: 8px; margin-top: -25px;">
<h4 style="float: left; position: absolute !important; margin-top: -20px; padding-bottom: 10px;"><i class="glyphicon glyphicon-tag"></i> <span style="font-weight: bold;" id="tag_view"></span></h4>
								<h4 style="float: left !important; position: absolute !important;">ពាក្យពេចន៍<br /><br /><span id="desc" style="font-size: 17px !important;"></span></h4></div><br /><br /><br />

								<!-- Fb comment -->
								<div id="fb-root"></div>
								<script>(function(d, s, id) {
									var js, fjs = d.getElementsByTagName(s)[0];
									if (d.getElementById(id)) return;
									js = d.createElement(s); js.id = id;
									js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
									fjs.parentNode.insertBefore(js, fjs);
								}(document, 'script', 'facebook-jssdk'));</script>
								<div id="fb-comments" class="fb-comments" style="z-index: 999999 !important; width: 100%;" data-width="100%" data-href="<?php echo base_url(); ?>" data-numposts="5" data-colorscheme="light"></div>
								<!-- End of FB Comment -->
								<div class="related_post_container">
									<h4>ប្រកាសដែលទាក់ទង </h4>
									<hr/>
									<ul  class="related_posts">

									</ul>
								</div>
							</div>

						</div>

						<span style="font-weight: bold;"><i class="glyphicon glyphicon-eye-open"></i>បង្ហាញ​&nbsp;<span class="count_views"></span> ដង</span>
					</div>
				</div>
			</div>
		</div>

		<!-- This popup for text /////////////////////////////////////////////////////////////////////////////////////////////-->

		<div class="modal" id="basicModalfortext" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="false">
			<div class="modal-dialog modal-vertical-centered" style="height: auto; top: 10%;">
				<div class="modal-content" style=" background: #FFF;">
					<div class="modal-header" style="padding-top: 30px;">
						<button onclick="clearIDCount_text()" type="button" class="close" data-dismiss="modal" aria-hidden="false" style="margin-top: -28px;"><img style="width:20px; height:20px;" src="<?php echo base_url().F_IMG; ?>closebtn.png" /></button>
						<!-- <h4 class="modal-title" id="myModalLabel">Modal title</h4> -->
					</div>
					<div class="modal-body" style="padding-top: 0;">
						<br />
						<div class="col-md-11" style="padding-bottom: 8px; margin-top: -25px;"><h4>ពាក្យពេចន៍</h4><span id="desc_text"></span></div><br /><br /><br />

						<div class="row" style="padding-bottom:0px !important;">
							<ul class="thumbnails">
								<div class="col-md-13" style="height: auto !important;">
									<li class="thumbnail social-media" style="height: 87px !important; width: 100%; background: none !important; margin-top: -10px; border: none;">

										<!-- facebook like button and share button -->

										<!-- Facebook like button -->
										<div id="fb-root"></div>
										<script>(function(d, s, id) {
											var js, fjs = d.getElementsByTagName(s)[0];
											if (d.getElementById(id)) return;
											js = d.createElement(s); js.id = id;
											js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
											fjs.parentNode.insertBefore(js, fjs);
										}(document, 'script', 'facebook-jssdk'));</script>

										<div id="facebooklikebutton" style="float: left; width: 60px;">
											<div class="fb-like fb-like_text" data-href="https://developers.facebook.com/docs/plugins/" data-width="100" data-layout="box_count" data-action="like" data-show-faces="false" data-share="false"></div>
										</div>
										<!-- End of Facebook like and share button -->
										<div class="googleplusbutton_text" style="float: left; width: 60px; height: 40px !important; margin-left: 5px; margin-top: 1px;">
											<script type="text/javascript">
												 (function() {
						var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
						po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback';
						var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
						})();
					</script>
<div id="plusone_text" class="g-plusone" data-size="tall" data-href="http://postleng.com"></div>
										</div>
										<div id="tweenbutton" style="float: left; width: 60px; margin-left: 6px; margin-top: -1px;">                        
											<!-- Tweet Button -->
											<a href="https://twitter.com/share" style="float: left;" class="twitter-share-button tweet" data-url="" data-counturl="" data-lang="en" data-count="vertical">Tweet</a>

											<script>
												!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
											</script>    
											<!-- End of Tweet button -->
										</div>
									</li>

									<li class="thumbnail social-media" style="height: auto; width: 100%; background: none !important;  margin-left: -22px; margin-top: -10px; border: none;">

										<!-- Fb comment -->
										<div id="fb-root"></div>
										<script>(function(d, s, id) {
											var js, fjs = d.getElementsByTagName(s)[0];
											if (d.getElementById(id)) return;
											js = d.createElement(s); js.id = id;
											js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
											fjs.parentNode.insertBefore(js, fjs);
										}(document, 'script', 'facebook-jssdk'));
										</script>
										<div id="fb-comments_text" class="fb-comments" style="width: 100%" data-width="100%" data-href="<?php echo base_url(); ?>" data-numposts="5" data-colorscheme="light"></div>
										<!-- End of FB Comment -->

									</li>
								</div>
							</ul>
						</div>
						<span style="font-weight: bold;">
						<i class="glyphicon glyphicon-eye-open"></i>បង្ហាញ​​&nbsp;<span style="font-wieght:bold;" class="count_views_text"></span> ដង</span> | <i class="glyphicon glyphicon-tag"></i>&nbsp;<span style="font-weight: bold;" id="tag_view_text"></span>

					</div>
				</div>
			</div>
		</div>

		<!-- End of popup of Text// -->

	<!-- pop up for emebed url --->
	<!-- This popup for text /////////////////////////////////////////////////////////////////////////////////////////////-->

	
	<div class="modal" id="basicModalULR" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="false">
		<div class="modal-dialog modal-vertical-centered " style="width: 95%;">
			<div class="modal-content" style=" background: #FFF;">
				<div class="modal-header" style="padding-top: 30px;">
					<button onclick="clearIDCountEmbed(this)" id="close_btn" row_video_count="test" type="button" class="close refresh_iframe" data-dismiss="modal" aria-hidden="true" style="margin-top: -28px;"><img style="width:20px; height:20px; " src="<?php echo base_url().F_IMG; ?>closebtn.png" /></button>
					<input type="hidden" style="background: none; border: none;" class="store_id" value="0"/>
				</div>
				<div class="modal-body" style="padding-top: 0;">
					<span id="flash">Please wait...</span>
					<div id="iframe"></div>
					<span style="font-weight: bold;"><i class="glyphicon glyphicon-eye-open"></i>បង្ហាញ​​&nbsp;<span style="font-wieght:bold;" class="count_views_embed"></span> ដង</span> |
					<i class="glyphicon glyphicon-tag"></i> <span style="font-weight: bold;" id="tag_code_url_name"></span>
				</div>
			</div>
		</div>
	</div>

	<!-- End of popup of Text// -->

	<!-- commment - -->
	<div class="modal" id="basicModalComment" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="false">
		<div class="modal-dialog modal-vertical-centered" style="height: auto; top: 10%;">
			<div class="modal-content" style=" background: #FFF;">
				<div class="modal-header" style="padding-top: 30px;">
					<button onclick="clearIDCount_text()" type="button" class="close" data-dismiss="modal" aria-hidden="false" style="margin-top: -28px;"><img onclick="clear_error()" style="width:20px; height:20px;" src="<?php echo base_url().F_IMG; ?>closebtn.png" /></button>
				</div>
				<div class="modal-body" style="padding-top: 0;">
					<br />
					<div class="col-xs-12 col-sm-6 col-md-8" style="margin-top: -25px;"><h4><i class="glyphicon glyphicon-comment"></i>&nbsp; យោ​បល់​របស់​អ្នក​មក​កាន់​វេប​សាយ​</h4></div><br />
					
					<div class="row" style="padding-bottom:0px !important;">
						<div class="col-xs-12 col-sm-6 col-md-8" >
							<form method="post" action="<?php echo base_url()."welcome/addedComment" ?>" onsubmit="return validateFormCreateComment()">
								<!-- Text input-->
								<div class="control-group">
									<label class="control-label" for="name"></label>
									<div class="controls">
										<input id="name" name="name" type="text" placeholder="ឈ្មោះរបស់អ្នក" class="input-xlarge form-control" required="">

									</div>
								</div>

								<!-- Text input-->
								<div class="control-group">
									<label class="control-label" for="email"></label>
									<div class="controls">
										<input id="email" name="email" type="text" placeholder="អ៊ីម៉ែល" class="input-xlarge form-control">

									</div>
								</div>

								<!-- Textarea -->
								<div class="control-group">
									<label class="control-label" for="comment"></label>
									<div class="controls">                     
										<textarea id="comment_user" name="comment_user" class="form-control"></textarea>
										<div id="error_desc_comment"></div>
									</div>
								</div>

								<!-- Button -->
								<div class="control-group">
									<label class="control-label" for="btn_comment"></label>
									<div class="controls">
										<div class="pull-right">
											<button type="submit" id="btn_comment" name="btn_comment" class="btn btn-custom-lighten-create btn_response btn-create"><i class="glyphicon glyphicon-ok"></i> យល់ព្រម</button>
											<button type="button" class="btn btn-default" onclick="clearData()"><i class="glyphicon glyphicon-repeat"></i> សា​រ​ដើម​</button>
										</div>
									</div>
								</div>

							</form>
						</div>

						
					</div>
					
				</div>
			</div>
		</div>
	</div>
	<!-- end comment -->
	<!-- end pop up for emebed url -->

	<script>

		function popUpDetail(obj){
			row_des = obj.getAttribute("row_des");
			row_img = obj.getAttribute("row_img");
			row_post_id = obj.getAttribute("row_id");
			count_click = obj.getAttribute("data_count_click");
			tag_id = obj.getAttribute("tag_id");
			row_tag = obj.getAttribute('row_tag');

			row_key_code = obj.getAttribute("row_key_code");
			row_base_url = obj.getAttribute("row_baseUrl");

			document.getElementById('desc').innerHTML = row_des;
			document.getElementById('tag_view').innerHTML = "<a href='"+row_base_url+row_key_code+"'>"+row_tag+"</a>";

			document.getElementById('img_view').setAttribute("style","display:block");
			document.getElementById('img_view').src = row_img;
			
			$("#fb-comments").attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebookcomments/postleng-freepost/'+row_post_id+'/facebook-shared');
                // $(".twitter-share-button").attr('data-counturl', post_fb_comment_url+Number(row_post_id));
                $(".fb-like").attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
                
                $(".tweet").attr('data-url', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
                $(".tweet").attr('data-counturl', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
                
                FB.XFBML.parse();

                $(".count_views").attr('class', 'count_views'+row_post_id);
                var mydatacount = $('.counting_view'+row_post_id).text();
                $('.count_views'+row_post_id).html(mydatacount);
                

               /* $.post("<?php echo base_url(); ?>welcome/update_count",{post_id:row_post_id},function(result){
                	$('#count_views'+row_post_id).html(result);
                	$('.counting_view'+row_post_id).html(result);
                });
*/
					
						
					$.get("<?php echo base_url(); ?>welcome/get_multi_tags",{post_id:row_post_id},function(result){
						$('#tag_view').html(result);
					});
					$.get("<?php echo base_url(); ?>welcome/releated_post",{tagId:tag_id},function(result){
						$('.related_posts').html(result);
					});
					(function() {
						var po = document.createElement('script'); po.releated_posttype = 'text/javascript'; po.async = true;
						po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback';
						var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
					})();
	                ///
	                $("#googleplusbutton").html('<div id="plusone_text" class="g-plusone" data-size="tall" data-href="http://postleng.com"></div>');
	                $('.g-plusone_text').attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
	            }
	            function clearIDCount(){

	            	$.post("<?php echo base_url(); ?>welcome/update_count",{post_id:row_post_id},function(result){
	            	//alert(row_post_id);
	            		$('.counting_view'+row_post_id).html(result);
	            		$('.count_views'+row_post_id).attr('class', 'count_views');
	            	});


	            }

	            function change_ajax_value(obj){
	            	row_des = obj.getAttribute("row_des");
	            	row_img = obj.getAttribute("row_img");
	            	row_post_id = obj.getAttribute("row_id");

	            	document.getElementById('desc').innerHTML = row_des;
	            	document.getElementById('img_view').src = row_img;

	            	$('.count_views').attr('class', '')
	            	$('.count_views').attr('class', 'count_views'+row_post_id)

	            	$("#fb-comments").attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebookcomments/postleng-freepost/'+row_post_id+'/facebook-shared');
                // $(".twitter-share-button").attr('data-counturl', post_fb_comment_url+Number(row_post_id));
                $(".fb-like").attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
                
                $(".tweet").attr('data-url', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
                $(".tweet").attr('data-counturl', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
                
                FB.XFBML.parse();
                (function() {
						var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
						po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback';
						var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
					})();
	                ///
	                $("#googleplusbutton").html('<div id="plusone_related" class="g-plusone" data-size="tall" data-href="http://postleng.com"></div>');
	                $('.g-plusone').attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');

                $.post("<?php echo base_url(); ?>welcome/update_count",{post_id:row_post_id},function(result){
	            		
	            	//alert(row_post_id);
	            		//$('.counting_view'+row_post_id).html(result);
	            		$('.count_views'+row_post_id).html(result);
	            		//$('.count_views'+row_post_id).attr('class', 'count_views');
	            });


            }
            function popUpText(obj){

            	row_des_text = obj.getAttribute("row_desc_text");
            	row_post_id_text = obj.getAttribute("row_id_text");
            	count_click_text = obj.getAttribute("data_count_click_text");
            	row_tag_text = obj.getAttribute("row_tag_text");

            	row_key_code = obj.getAttribute("row_key_code");
            	row_base_url = obj.getAttribute("row_baseUrl");

            	document.getElementById('desc_text').innerHTML = row_des_text;
            	document.getElementById('tag_view_text').innerHTML ="<a href='"+row_base_url+row_key_code+"'>"+row_tag_text+"</a>";

            	$("#fb-comments_text").attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebookcomments/postleng-freepost/'+row_post_id_text+'/facebook-shared');
                // $(".twitter-share-button").attr('data-counturl', post_fb_comment_url+Number(row_post_id));
                $(".fb-like_text").attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id_text+'/facebook-shared');
                
                $(".tweet_text").attr('data-url', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id_text+'/facebook-shared');
                $(".tweet_text").attr('data-counturl', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id_text+'/facebook-shared');
                FB.XFBML.parse();
               
	                //$(".googleplusbutton_text").html('<div id="plusone_text" class="g-plusone_text" data-size="tall" data-href="http://postleng.com"></div>');
	               	//var a = $(".googleplusbutton_text").text();
	               //	alert(a);
	               $('.g-plusone_text').attr('data-href', '<?php echo base_url(); ?>'+'welcome/facebooklikebutton/postleng-freepost/'+row_post_id+'/facebook-shared');
	               gapi.plusone.render();

                $(".count_views_text").attr('class', 'count_views_text'+row_post_id_text);

                var mydatacount_text = $(".counting_view_text"+row_post_id_text).text();
                $(".count_views_text"+row_post_id_text).html(mydatacount_text);
}
        /// Reset new id for text popup 
        function clearIDCount_text(){

        	$.post("<?php echo base_url(); ?>welcome/update_count",{post_id:row_post_id_text},function(result){
        		
        		$('.counting_view_text'+row_post_id_text).html(result);
        		$('.count_views_text'+row_post_id_text).attr('class', 'count_views_text');
        	});
        	

        }

        $('#basicModal').modal(options);
    </script>
    <!-- Docs master nav -->
    <?php $this -> load -> view(F_MASTER . "header"); ?>
    <br />
    <?php $this -> load -> view(F_MASTER . "tags"); ?>
    
    <!-- End of Resonsive Header -->    
    <div class="col-md-12" style="padding-top: 0px; padding-bottom: 7px; padding-right: 0; padding-left: 0;">
    	<div class="bs-example div-menu" style="background: #324F68;">
    		<div class="btn-group dropdown-redBg custom btn_response">
    			<a href="<?php echo base_url(); ?>" id="dropdown-toggle" class="btn btn-custom-lighten dropdown-toggle home-text-btn <?php if($this->uri->segment(1) == ""){?> btn-custom-lighten-create <?php } ?>" style="text-align: left;"> <i class="glyphicon glyphicon-home"></i>&nbsp;&nbsp;<span class="home-text">ទំព័រដើម</span></a>

        		<?php if(!isset($error) ) //// check if isset error 
        		{ 
        			?>
        			<?php 
        			$srleng_url  = strlen($this->uri->segment(3));
        			if($this->uri->segment(1)!="posts" && $this->uri->segment(2)!="create-post" && $this->uri->segment(2)!="get-popular-tag"){
        				?>	
        				
        				<button data-toggle="dropdown" tabindex="-1" class="btn btn-danger btn-custom-lighten btn_response" style="text-align: left;">
        					<i class="glyphicon glyphicon-sort-by-alphabet "></i> ចំរាញ់លទ្ធផល
        					<span class="caret"></span>
        				</button>
        				<ul class="dropdown-menu btn_response">
        					<?php
        					$key1= $this->uri->segment(1); $function = $this->uri->segment(2); $key = $this->uri->segment(3);
        					if(!$this->uri->segment(1) || $function=="get-data-by-sort" || ($function=="get-data-by-sort" && $key!=""))
        					{
        						?>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-sort/one-day-ago">  1 ថ្ងែមុន</a>
        						</li>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-sort/three-days-ago"> 3 ថ្ងែមុន</a>
        						</li>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-sort/one-week-ago">  7 ថ្ងែមុន</a>
        						</li>
        						<?php
        					}else if(
        						($function=="get-data-by-tag" || $function=="get-data-by-time-and-sort") && ($key!="")
        						|| ($function=="get-data-by-tag" || $function=="get-data-by-time-and-sort") && (strlen($key)<13 && strlen($key) >13)

        						)
        					{
        						?>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-time-and-sort/<?php echo $this -> uri -> segment(3); ?>/one-day-ago">  1 ថ្ងែមុន</a>
        						</li>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-time-and-sort/<?php echo $this -> uri -> segment(3); ?>/three-days-ago"> 3 ថ្ងែមុន</a>
        						</li>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-time-and-sort/<?php echo $this -> uri -> segment(3); ?>/one-week-ago">  7 ថ្ងែមុន</a>
        						</li>
        						<?php
        					}else if((($function=="get-data-by-search" || $function=="get-data-by-search-and-sort") && (isset($_GET['tag']) && $_GET['tag']!="")))
        					{
        						
        						?>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-search-and-sort/<?php echo isset($_GET['tag'])?"?tag=".str_replace(" ","+",$_GET['tag']):""; ?>&time=one-day-ago">  1 ថ្ងែមុន</a>
        						</li>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-search-and-sort/<?php echo isset($_GET['tag'])?"?tag=".str_replace(" ","+",$_GET['tag']):""; ?>&time=three-days-ago"> 3 ថ្ងែមុន</a>
        						</li>
        						<li role="presentation">
        							<a role="menuitem" tabindex="-1" href="<?php echo base_url(); ?>tags/get-data-by-search-and-sort/<?php echo isset($_GET['tag'])?"?tag=".str_replace(" ","+",$_GET['tag']):""; ?>&time=one-week-ago">  7 ថ្ងែមុន</a>
        						</li>
        						<?php
        					}
        					?>
        				</ul>
        				<?php
					} /// end posts
					?>
					<?php
				}
				?>	
			</div>
			<?php 
			$active_btn = $this->uri->segment(2);
			?>
			<!-- /pills -->
			<a href="<?php echo base_url(); ?>posts/most-read" class="btn btn-custom-lighten btn_response <?php if($active_btn == "most-read"){?> btn-custom-lighten-create <?php } ?>" style="text-align: left;margin-left: 0px;"> <i class="glyphicon glyphicon-star orange"></i> ប្រកាស ពេញនិយម</a>
			<a href="<?php echo base_url(); ?>tags/get-popular-tag" class="btn btn-custom-lighten btn_response <?php if($active_btn == "get-popular-tag"){?> btn-custom-lighten-create <?php } ?>" style="text-align: left;margin-left: 0px; "> <i class="glyphicon glyphicon-tag "></i> ពាក្យគន្លឺះ ពេញនិយម</a>
			<a href="#" data-toggle="modal" onclick="comment_on_postleng()" data-target="#basicModalComment" class="btn btn-custom-lighten btn_response" style="text-align: left;margin-left: 0px; "><i class="glyphicon glyphicon-comment"></i> Comment</a>
			<a href="<?php echo base_url(); ?>posts/create-post" class="btn btn-custom-lighten dropdown-toggle home-text-btn <?php echo ($active_btn=="create-post")?"btn-custom-lighten-create":"btn-custom-lighten"; ?> btn_response new-post-btn" style="float: right; text-align: left; margin-left: 0px;"><i class="glyphicon glyphicon-pencil"></i>&nbsp; ប្រកាសថ្មី </a>
			
		</div>
		<!-- /example --><!-- glyphicon glyphicon-home -->
	</div>

	<?php
        	//// condition when error message ////
	if(isset($error)){
		$this->load->view(F_TEMPLATE.'page_error/page_not_found');
	        }else{ /// Master pages
	        	if ($this -> uri -> segment(1) == "") {
	        		$this -> load -> view(F_MASTER . "content");
	        	} else {
	        		$this -> load -> view(F_TEMPLATE . str_replace('-', '_', $this -> uri -> segment(1)) . '/' . (($this -> uri -> segment(2) == '') ? 'index' : str_replace('-', '_', $this -> uri -> segment(2))));
	        	}
	        }
	        ?>
	        <script>
	        	$(document).ready(function() {
	        		$(".tag-autocomplete").autocomplete("<?php echo base_url(); ?>tags/auto_complete", {
	        			selectFirst: true
	        		});
	        	});
	        </script>
	        <script>
	        	d = document;
	        	function tag_index(obj){
	        		var a  = obj.value;
	        		d.getElementById("tag-header").value = a;
	        	} 
	        </script>
	        <script>
	        	function validateFormCreateComment() {
	        		var file_selected = false;
	        		var desc = document.getElementById("comment_user").value;
	        		if (desc == "" && !file_selected) {
	        			document.getElementById("error_desc_comment").innerHTML = "&nbsp;&nbsp;&nbsp;<p style='color:red'><i class='glyphicon glyphicon-warning-sign'></i>&nbsp;សូម​​ប​ញ្ជូល​មតិ​ជា​មុន​សិន!</p>";
	        			return false;
	        		}
	        	}
	        	function clearData(){
	        		document.getElementById("comment_user").value="";
	        		document.getElementById("name").value="";
	        		document.getElementById("email").value="";
	        		document.getElementById("error_desc_comment").innerHTML="";
	        	}
	        	function clear_error(){
	        		document.getElementById("comment_user").value="";
	        		document.getElementById("name").value="";
	        		document.getElementById("email").value="";
	        		document.getElementById("error_desc_comment").innerHTML="";
	        	}
	        </script>
	        <script type="text/javascript">
	        	

	        	function emebd_video_image(obj){
	        		
	        		var row_code_url = obj.getAttribute("row_code_url");
	        		var row_tag_code_url = obj.getAttribute("row_tag_name_embed");


	        		$("#flash").fadeIn(1000);
	        		if(row_tag_code_url !=""){
	        			setTimeout(function(){
	        				$("#flash").fadeOut(1000);
	        				var row_post_id_embed = obj.getAttribute("row_post_id_embed");
	        				var row_count_click_embed = obj.getAttribute("row_count_click_embed");
	        				row_key_code = obj.getAttribute("row_key_code");
	        				row_base_url = obj.getAttribute("row_baseUrl");
	        				$("#tag_code_url_name").html("<a href='"+row_base_url+row_key_code+"'>"+row_tag_code_url+"</a>");
	        				$("#iframe").html("<iframe src='"+row_code_url+"' style='width:100%; height:500px;' allowfullscreen='true' allowscriptaccess='always' scrolling='yes' frameborder='0'>"+"</iframe>");
	        				
	        				$(".store_id").val(row_post_id_embed);
							$('.count_views_embed').attr('class', 'count_views_embed'+row_post_id_embed);


	        				var mydatacount_embed = $('.counting_view_embed'+row_post_id_embed).text();
              				$('.count_views_embed'+row_post_id_embed).html(mydatacount_embed);

	        				
	        			},3500);
	        		}
	        	}
	        	$(".refresh_iframe").click(function(){
	        		$("#tag_code_url_name").html('');
	        		$("#iframe").html("");
	        	});

	        	function clearIDCountEmbed(obj){
	        		var getId = $(".store_id").val();
	        		var resultId = parseInt(getId);
	        		
	        		$.post("<?php echo base_url(); ?>welcome/update_count",{post_id:resultId},function(result){
	        			
	        			$('.counting_view_embed'+resultId).html(result);
	        			$('.count_views_embed'+resultId).html(result);
	        			$('.count_views_embed'+resultId).attr('class', 'count_views_embed');
	        		});


	        		$(".store_id").val("");
	        	}
	        </script>
	        <div id="test"></div>
	        <!-- and auto complete search -->
	        <!-- respon image -->
	        <script type="text/javascript" src="<?php echo base_url() . F_JS; ?>jquery-1.6.2.min.js"></script>
	        <script type="text/javascript" src="<?php echo base_url() . F_JS; ?>select_box.js"></script>
	        <script type="text/javascript" src="<?php echo base_url() . F_JS; ?>jquery.autocomplete.js"></script>
	        <script type="text/javascript" src="<?php echo base_url() . F_JS; ?>bootstrap-filestyle.min.js"></script>
	        <script type="text/javascript" src="<?php echo base_url() . F_JS; ?>loading_create_posts.js"></script>
	        <script type="text/javascript">
	        	$(":file").filestyle({buttonBefore: true});
	        </script>
	        <script src="<?php echo base_url() . F_JS; ?>chosen.jquery.js" type="text/javascript"></script>
	        <script src="<?php echo base_url() . F_JS; ?>prism.js" type="text/javascript" charset="utf-8"></script>
	        <script type="text/javascript">
	        	var config = {
	        		'.chosen-select'           : {},
	        		'.chosen-select-deselect'  : {allow_single_deselect:true},
	        		'.chosen-select-no-single' : {disable_search_threshold:10},
	        		'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
	        		'.chosen-select-width'     : {width:"95%"}
	        	}
	        	for (var selector in config) {
	        		$(selector).chosen(config[selector]);
	        	}
	        </script>
	        <script type="text/javascript" src="<?php echo base_url() . F_JS; ?>jquery.oembed.js"></script>
	        <!--- disadble Enter  - -->
	        <script src="<?php echo base_url() . F_JS; ?>disable_enter.js" type="text/javascript"></script>
	    </body>
